﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;
using System.ComponentModel.DataAnnotations;

namespace ZDSoft.LMS.Domain
{
    [ActiveRecord("Vehicle")]
    public class Vehicle : EntityBase
    {
        /// <summary>
        /// 车牌号
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "车牌号")]
        [Required(ErrorMessage = "不能为空")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string VehicleNumber { get; set; }

        /// <summary>
        /// 所属单位
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "所属单位")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string DepartmentName { get; set; }

        /// <summary>
        /// 车辆型号
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "车辆型号")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string VehicleType { get; set; }

        /// <summary>
        /// 核定载重
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "核定载重")]
        [Required(ErrorMessage = "不能为空!")]
        public virtual decimal LoadCount { get; set; }

        /// <summary>
        /// 月折旧
        /// </summary>
        [Property(NotNull = true, Length = 100)]
        [Display(Name = "月折旧")]
        [Required(ErrorMessage = "不能为空!")]
        [Range(0, 100, ErrorMessage = "月折旧只能在0~100之间！")]
        public virtual decimal MonthlyDepreciation { get; set; }

        /// <summary>
        /// 载重油耗
        /// </summary>
        [Property(NotNull = true, Length = 200)]
        [Display(Name = "载重油耗")]
        [Required(ErrorMessage = "不能为空!")]
        [Range(0, 200, ErrorMessage = "载重油耗只能在0~200之间!")]
        public virtual decimal LoadedFuelConsumption { get; set; }

        /// <summary>
        /// 空车油耗
        /// </summary>
        [Property(NotNull = true, Length = 200)]
        [Display(Name = "空车油耗")]
        [Required(ErrorMessage = "不能为空!")]
        [Range(0, 200, ErrorMessage = "只能在0~200之间!")]
        public virtual decimal EmptyFuelConsumption { get; set; }

        /// <summary>
        /// 发动机号码
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "发动机号码")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string GenerateNumber { get; set; }

        /// <summary>
        /// 保单号
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "保单号")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string InsuranceNumber { get; set; }

        /// <summary>
        /// 车架号
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "车架号")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string FrameNumber { get; set; }

        /// <summary>
        /// 底盘号
        /// </summary>
        [Property(NotNull = true, Length = 50)]
        [Display(Name = "底盘号")]
        [Required(ErrorMessage = "不能为空!")]
        [StringLength(50, ErrorMessage = "不能超过50个字符!")]
        public virtual string ChassisNumber { get; set; }


        [HasMany(typeof(DeliveryForm), Table = "DeliveryForm", ColumnKey = "TransportCarID", Lazy = true)]
        public virtual IList<DeliveryForm> DeliveryForms { get; set; }
    }
}
